import { IPSDataEntity } from '../../ipsdata-entity';
import { IPSDEField } from '../ipsdefield';
import { IPSDEFVRValueRangeCondition } from './ipsdefvrvalue-range-condition';
import { PSDEFVRSingleConditionImpl } from './psdefvrsingle-condition-impl';
import { IPSDEDataSet } from '../../ds/ipsdedata-set';

export class PSDEFVRValueRangeConditionImpl extends PSDEFVRSingleConditionImpl implements IPSDEFVRValueRangeCondition {
  protected extmajorpsdefield: IPSDEField | null = null;

  getExtMajorPSDEField(): IPSDEField | null {
    if (this.extmajorpsdefield != null) return this.extmajorpsdefield;
    const value = this.M.getExtMajorPSDEField;
    if (value == null) {
      return null;
    }
    this.extmajorpsdefield = this.getPSModel4('dataentity.defield.IPSDEField', value, 'getExtMajorPSDEField') as IPSDEField;
    return this.extmajorpsdefield;
  }

  get extMajorPSDEField(): IPSDEField | null {
    return this.getExtMajorPSDEField();
  }

  getExtMajorPSDEFieldMust(): IPSDEField {
    const value = this.getExtMajorPSDEField();
    if (value == null) {
      throw new Error('未指定附加主实体属性对象');
    }
    return value;
  }

  protected extpsdefield: IPSDEField | null = null;

  getExtPSDEField(): IPSDEField | null {
    if (this.extpsdefield != null) return this.extpsdefield;
    const value = this.M.getExtPSDEField;
    if (value == null) {
      return null;
    }
    this.extpsdefield = this.getPSModel4('dataentity.defield.IPSDEField', value, 'getExtPSDEField') as IPSDEField;
    return this.extpsdefield;
  }

  get extPSDEField(): IPSDEField | null {
    return this.getExtPSDEField();
  }

  getExtPSDEFieldMust(): IPSDEField {
    const value = this.getExtPSDEField();
    if (value == null) {
      throw new Error('未指定附加属性对象');
    }
    return value;
  }

  protected majorpsdedataset: IPSDEDataSet | null = null;

  getMajorPSDEDataSet(): IPSDEDataSet | null {
    if (this.majorpsdedataset != null) return this.majorpsdedataset;
    const value = this.M.getMajorPSDEDataSet;
    if (value == null) {
      return null;
    }
    this.majorpsdedataset = this.getPSModel4('dataentity.ds.IPSDEDataSet', value, 'getMajorPSDEDataSet') as IPSDEDataSet;
    return this.majorpsdedataset;
  }

  get majorPSDEDataSet(): IPSDEDataSet | null {
    return this.getMajorPSDEDataSet();
  }

  getMajorPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getMajorPSDEDataSet();
    if (value == null) {
      throw new Error('未指定主实体结果集对象');
    }
    return value;
  }

  protected majorpsdataentity: IPSDataEntity | null = null;

  getMajorPSDataEntity(): IPSDataEntity | null {
    if (this.majorpsdataentity != null) return this.majorpsdataentity;
    const value = this.M.getMajorPSDataEntity;
    if (value == null) {
      return null;
    }
    this.majorpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getMajorPSDataEntity') as IPSDataEntity;
    return this.majorpsdataentity;
  }

  get majorPSDataEntity(): IPSDataEntity | null {
    return this.getMajorPSDataEntity();
  }

  getMajorPSDataEntityMust(): IPSDataEntity {
    const value = this.getMajorPSDataEntity();
    if (value == null) {
      throw new Error('未指定主实体对象');
    }
    return value;
  }

  get alwaysCheck(): boolean {
    return this.M.alwaysCheck;
  }

  get tryMode(): boolean {
    return this.M.tryMode;
  }

  get cls(): string {
    return 'PSDEFVRValueRangeConditionImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.defield.valuerule.IPSDEFVRValueRangeCondition') return true;
    return super.instanceof(cls);
  }
}
